package com.ykht.proj.coupon.Enum;

/**
 * 分销类型 0 注册   1 转发  2 核销 3关注 4收藏
 */
public enum DistributionTypeEnum {
	DISTRIBUTION_TYPE_0(0,"邀请"),
	DISTRIBUTION_TYPE_1(1,"转发"),
	DISTRIBUTION_TYPE_2(2,"核销"),
	DISTRIBUTION_TYPE_3(3,"关注"),
	DISTRIBUTION_TYPE_4(4,"收藏");

	private Integer value;
	private String desc;

	private DistributionTypeEnum(Integer value, String desc) {
		this.value = value;
		this.desc = desc;
	}


	/**
	 * 根据val值获取desc
	 * @param val 1、0
	 * @return
	 */
	public static String getDescByVal(Integer val) {
		DelFlagEnum[] values = DelFlagEnum.values();
		for (DelFlagEnum oe : values) {
			if (oe.getValue().equals(val)) {
				return oe.getDesc();
			}
		}
		return null;
	}

	public static DistributionTypeEnum getThisByVal(Integer val) {
		DistributionTypeEnum[] values = DistributionTypeEnum.values();
		for (DistributionTypeEnum oe : values) {
			if (oe.getValue().equals(val)) {
				return oe;
			}
		}
		return null;
	}
	public static DistributionTypeEnum getThisByDesc(String desc) {
		DistributionTypeEnum[] values = DistributionTypeEnum.values();
		for (DistributionTypeEnum oe : values) {
			if (oe.getDesc().equals(desc)) {
				return oe;
			}
		}
		return null;
	}

	public Integer getValue() {
		return value;
	}

	public void setValue(Integer value) {
		this.value = value;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}
